package cn.lutu.domain.repository.impl;

import cn.lutu.dao.mapper.SpotMapper;
import cn.lutu.dao.mapper.UserMapper;
import cn.lutu.domain.repository.UserRepository;
import cn.lutu.protocol.entity.User;
import cn.lutu.protocol.vo.UserVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
@Slf4j
public class UserRepositoryImpl implements UserRepository {
    @Autowired
    UserMapper userMapper;
    @Autowired
    SpotMapper spotMapper;
    @Override
    public UserVO selectByUserName(String userName) {
        log.debug("开始执行【根据用户名查询用户登录信息】的数据访问，参数：{}", userName);
        return userMapper.selectByUserName(userName);
    }

    @Override
    public UserVO selectById(Long id) {
        log.debug("开始执行【根据ID查询用户详情】的数据访问，参数：{}", id);
        return userMapper.selectById(id);
    }

    @Override
    public int updateInfoById(User user) {
        log.debug("开始执行【更新用户】的数据访问，参数：{}", user);
        return userMapper.updateById(user);
    }

    @Override
    public int updatePassword(User user) {
        log.debug("开始执行【更新用户】的数据访问，参数：{}", user);
        return userMapper.updatePassword(user);
    }

    @Override
    public int insert(User user) {
        return userMapper.insert(user);
    }
}
